<h1 class="page-header">
    <small>卡券核销</small>
</h1>
<hr/>
<div class="panel panel-inverse" data-sortable-id="form-stuff-1">
    <div class="panel-heading">
        <h4 class="panel-title">卡券核销</h4>
    </div>
    <div class="panel-body">
        <div class="confirm-form">
            <form id="confirmForm" name="confirmForm" method="post" onSubmit="return false;" class="form-horizontal">
                <div class="form-group">
                    <label class="col-md-2 control-label"><span class="requiredstar">*</span>核销码：</label>
                    <div class="col-md-6">
                        <input type="text" id="code" class="form-control qr-code" name="code" placeholder="请扫描或输入核销码" rangelength="1,1000" required/>
                    </div>
                    <div class="col-md-3 do-confirm">
                        <button type="button" class="btn confirm-btn btn-danger" onclick="toConfirm()">确定核销</button>
                        <button type="button" class="btn btn-sm btn-success back-btn" onclick="getData('${rc.contextPath}/backend/home/index','displayArea')">返回主页</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="application/javascript">
    // 扫码枪回车事件
    $('#code').bind('keyup', function(event) {
        if (event.keyCode == "13") {
            toConfirm();
            return false;
        }
    });
    // 核销卡券
    function toConfirm() {
       const code = $("#code").val();
       if (code.length < 6) {
          layer.alert("请输入正确的核销码！");
          return false;
       }
       alterpage('${rc.contextPath}/backend/doConfirm/index?code='+code, "核销卡券");
    }
</script>